package com.iqiyi.pps.epg.core.model.rtmp;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "rtmp_server_stat")
@Cache(usage = CacheConcurrencyStrategy.NONE)
public class RtmpServerStat {
    public static final int STATUS_VALID = 2; // 有效
    public static final int STATUS_INVALID = 1; // 无效
    public static final int ACTIVE_VALID = 2; // 在编码
    public static final int ACTIVE_INVALID = 1; // 未编码

    private Long id;
    private Integer serverId;
    private String name;
    private Integer reconn;
    private Long inBytes;
    private Long outBytes;
    private Long inputBits;
    private Long outputBits;
    private String address;
    private Integer width;
    private Integer height;
    private Integer framerate;
    private Integer bitrate;
    private String video;
    private String audio;
    private Integer active;
    private Long uptime;
    private Integer status;
    private Timestamp createTime = new Timestamp(System.currentTimeMillis());
    private Timestamp modifyTime;

    public RtmpServerStat copyData(RtmpServerStat entity) {
        this.setServerId(entity.getServerId());
        this.setName(entity.getName());
        this.setReconn(entity.getReconn());
        this.setInBytes(entity.getInBytes());
        this.setOutBytes(entity.getOutBytes());
        this.setInputBits(entity.getInputBits());
        this.setOutputBits(entity.getOutputBits());
        this.setAddress(entity.getAddress());
        this.setWidth(entity.getWidth());
        this.setHeight(entity.getHeight());
        this.setFramerate(entity.getFramerate());
        this.setBitrate(entity.getBitrate());
        this.setVideo(entity.getVideo());
        this.setAudio(entity.getAudio());
        this.setActive(entity.getActive());
        this.setUptime(entity.getUptime());
        this.setStatus(entity.getStatus());
        this.setModifyTime(entity.getModifyTime());
        return this;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "server_id")
    public Integer getServerId() {
        return serverId;
    }

    public void setServerId(Integer serverId) {
        this.serverId = serverId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getReconn() {
        return reconn;
    }

    public void setReconn(Integer reconn) {
        this.reconn = reconn;
    }

    @Column(name = "in_bytes")
    public Long getInBytes() {
        return inBytes;
    }

    public void setInBytes(Long inBytes) {
        this.inBytes = inBytes;
    }

    @Column(name = "out_bytes")
    public Long getOutBytes() {
        return outBytes;
    }

    public void setOutBytes(Long outBytes) {
        this.outBytes = outBytes;
    }

    @Column(name = "input_bits")
    public Long getInputBits() {
        return inputBits;
    }

    public void setInputBits(Long inputBits) {
        this.inputBits = inputBits;
    }

    @Column(name = "output_bits")
    public Long getOutputBits() {
        return outputBits;
    }

    public void setOutputBits(Long outputBits) {
        this.outputBits = outputBits;
    }

    @Column(length = 15)
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getWidth() {
        return width;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public Integer getFramerate() {
        return framerate;
    }

    public void setFramerate(Integer framerate) {
        this.framerate = framerate;
    }

    public Integer getBitrate() {
        return bitrate;
    }

    public void setBitrate(Integer bitrate) {
        this.bitrate = bitrate;
    }

    public String getVideo() {
        return video;
    }

    public void setVideo(String video) {
        this.video = video;
    }

    public String getAudio() {
        return audio;
    }

    public void setAudio(String audio) {
        this.audio = audio;
    }

    public Integer getActive() {
        return active;
    }

    public void setActive(Integer active) {
        this.active = active;
    }

    public Long getUptime() {
        return uptime;
    }

    public void setUptime(Long uptime) {
        this.uptime = uptime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Column(name = "create_time", updatable = false)
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Column(name = "modify_time",insertable = false, updatable = false)
    public Timestamp getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Timestamp modifyTime) {
        this.modifyTime = modifyTime;
    }
}
